package ihm.manes_ho.agenda.vo;

/**
 * This class represents an article entity
 */
public class ArticleVO {
	private CharSequence name;
	private int quantity;
	private double price;
	
	public ArticleVO() {}

	public ArticleVO(CharSequence name, int quantity, double price) {
		super();
		this.name = name;
		this.quantity = quantity;
		this.price = price;
	}

	public CharSequence getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}
	
	@Override
	public String toString() {
		return name + " / " + quantity + " / " + price;
	}
	
	@Override
	public boolean equals(Object o) {
		if (!(o instanceof ArticleVO))
			return false;
		
		if (this.getName().equals(((ArticleVO) o).getName()))
			return true;
		
		return false;
	}
	
	@Override
	public int hashCode() {
		return getName().hashCode();
	}
}
